package com.ruoyi.student.recordprogress.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.student.recordprogress.domain.Recordprogress;
import com.ruoyi.student.recordprogress.service.IRecordprogressService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 跟进类型管理Controller
 * 
 * @author dj
 * @date 2025-06-24
 */
@RestController
@RequestMapping("/recordprogress/recordprogress")
public class RecordprogressController extends BaseController
{
    @Autowired
    private IRecordprogressService recordprogressService;

    /**
     * 查询跟进类型管理列表
     */
    @PreAuthorize("@ss.hasPermi('recordprogress:recordprogress:list')")
    @GetMapping("/list")
    public TableDataInfo list(Recordprogress recordprogress)
    {
        System.out.println("ffffff"+recordprogress.getState());
        startPage();
        List<Recordprogress> list = recordprogressService.selectRecordprogressList(recordprogress);
        return getDataTable(list);
    }

    /**
     * 导出跟进类型管理列表
     */
    @PreAuthorize("@ss.hasPermi('recordprogress:recordprogress:export')")
    @Log(title = "跟进类型管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Recordprogress recordprogress)
    {
        List<Recordprogress> list = recordprogressService.selectRecordprogressList(recordprogress);
        ExcelUtil<Recordprogress> util = new ExcelUtil<Recordprogress>(Recordprogress.class);
        util.exportExcel(response, list, "跟进类型管理数据");
    }

    /**
     * 获取跟进类型管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('recordprogress:recordprogress:query')")
    @GetMapping(value = "/{recordProgressId}")
    public AjaxResult getInfo(@PathVariable("recordProgressId") Long recordProgressId)
    {
        return success(recordprogressService.selectRecordprogressByRecordProgressId(recordProgressId));
    }

    /**
     * 新增跟进类型管理
     */
    @PreAuthorize("@ss.hasPermi('recordprogress:recordprogress:add')")
    @Log(title = "跟进类型管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Recordprogress recordprogress)
    {
        return toAjax(recordprogressService.insertRecordprogress(recordprogress));
    }

    /**
     * 修改跟进类型管理
     */
    @PreAuthorize("@ss.hasPermi('recordprogress:recordprogress:edit')")
    @Log(title = "跟进类型管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Recordprogress recordprogress)
    {
        return toAjax(recordprogressService.updateRecordprogress(recordprogress));
    }

    /**
     * 删除跟进类型管理
     */
    @PreAuthorize("@ss.hasPermi('recordprogress:recordprogress:remove')")
    @Log(title = "跟进类型管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{recordProgressIds}")
    public AjaxResult remove(@PathVariable Long[] recordProgressIds)
    {
        return toAjax(recordprogressService.deleteRecordprogressByRecordProgressIds(recordProgressIds));
    }
}
